/*
 * @Author: zhoujieyu zhoujieyu_web@163.com
 * @Date: 2024-10-08 09:25:13
 * @LastEditors: zhoujieyu zhoujieyu_web@163.com
 * @LastEditTime: 2024-10-23 15:59:59
 * @FilePath: \Code\src\Views\home\CityTraffic\right\chtOpt.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import * as echarts from 'echarts'
export const option1 = () => {
  const scaleData = [
    {
      name: '红灯 39',
      value: 39,
      radius1: [45, 50],
      radius2: '25%'
    },
    {
      name: '黄灯 96',
      value: 96,
      radius1: [60, 65],
      radius2: '30%'
    },
    {
      name: '绿灯 288',
      value: 288,
      radius1: [75, 80],
      radius2: '35%'
    },
    {
      name: '挂起 463',
      value: 463,
      radius1: [90, 95],
      radius2: '40%'
    }
  ]
  const placeHolderStyle = {
    label: {
      show: false
    },
    labelLine: {
      show: false
    },
    color: 'rgba(0, 0, 0, 0)',
    borderColor: 'rgba(0, 0, 0, 0)',
    borderWidth: 0
  }
  const seriesObj = []
  const color = ['#FF647C', '#FFBE75', '#3EE2A5', '#6C77FD']
  for (var i = 0; i < scaleData.length; i++) {
    seriesObj.push({
      name: '',
      type: 'pie',
      radius: scaleData[i].radius1,
      emphasis: {
        scale: false
      },
      itemStyle: {
        label: {
          show: false,
          color: '#ddd'
        }
      },
      data: [
        {
          value: scaleData[i].value,
          name: scaleData[i].name,
          itemStyle: {
            borderWidth: 5,
            borderColor: color[i]
          }
        },
        {
          value: 200,
          name: '',
          itemStyle: placeHolderStyle
        }
      ]
    })
  }
  return {
    color: color,
    tooltip: {
      show: false
    },
    legend: {
      orient: 'vertical',
      x: '50',
      y: '80',
      itemGap: 12,
      data: ['挂起 463', '绿灯 288', '黄灯 96', '红灯 39'],
      show: true,
      textStyle: {
        color: '#fff'
      }
    },
    toolbox: {
      show: false
    },
    series: seriesObj
  }
}
